// 用户接口管理
import request from "@/utils/request";
import type { UserResponse, UserAllocRoleRequest, UserLoginRequest, UserLoginReponse, } from "./types";
import type { BooleanResponseData } from '@/api/common/CommonResponse'

export enum API {
  PAGE = "user/page",
  GET_BY_ID = "/user/getById",
  CREATE = "/user/create",
  EDIT = "/user/edit",
  REMOVE = "/user/remove",
  BATCH_REMOVE = "/user/batchRemove",
  changeStatus = "/pmsBrand/changeStatus",

  USER_LOGIN = "/user/login",
  USER_ALLOC_ROLE = "/user/allocRole",
  USET_INFO = "/user/info",
  USER_LOGOUT = "/user/logout"
}

export const userLogin = (data: UserLoginRequest) =>
  request.post<any, UserLoginReponse>(API.USER_LOGIN, data);

export const userAllocRole = (data: UserAllocRoleRequest) =>
  request.post<any, BooleanResponseData>(API.USER_ALLOC_ROLE, data);

export const userInfo = () => request.get<any, UserResponse>(API.USET_INFO);

export const userLogout = () =>
  request.post<any, BooleanResponseData>(API.USER_LOGOUT);
